package com.cby.android.sample.model

import android.app.Application
import com.cby.android.library.base.BasePageStateViewModel
import com.cby.android.sample.bean.roll.RollNewsInfoBean
import com.cby.android.sample.repository.RollApiImpl

/**
 * @description: RollNewsViewModel
 *
 * @author ChenBaoyang
 * @date 4/28/21 17:47
 */
class RollNewsListViewModel(application: Application) : BasePageStateViewModel<RollNewsInfoBean>(application){

    private val rollApi = RollApiImpl()

    var typeId: Int = 0

    override suspend fun loadPageData(page: Int): MutableList<RollNewsInfoBean> {
        val response = rollApi.getNewsList(typeId, page)
        return if(response.data == null) mutableListOf() else response.data as MutableList<RollNewsInfoBean>
    }


}